home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 3
/
Gold Medal Software - Volume 3 (Gold Medal) (1994).iso
/
print
/
cramv33.arj
/
FILTER1.C
< prev
next >
Wrap
Text File
|
1991-10-12
|
786b
|
40 lines
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include <io.h>
#define REC_SIZE 256
int main ()
{
int status = 0;
char file_buf[REC_SIZE];
status = setmode ( fileno (stdin), O_BINARY );
while ( (status = fread (file_buf, 1, REC_SIZE, stdin) ) != 0 ) {
filter_rec (file_buf, status);
};
return (0);
}
int filter_rec (file_buf, record_size)
char *file_buf;
int record_size;
{
int i;
for (i = 0; i < record_size; i++) {
if (file_buf[i] == 0x0A) return 1;
if (file_buf[i] == 0x0D) {
putc (0x0A, stdout);
return 1;
};
putc (file_buf[i], stdout);
};
return 1;
}